package CircuitLogic;
/*
	电路元件中的滑动变阻器
 */
public class SlideRheostat extends Components
{
	/*
		此值为滑条到变阻器左端的距离占比，在0~1之间
	 */
	private double slidePercent;

	final double totalResistance = 3000;
	SlideRheostat()
	{
		slidePercent = 0;
		setResistance(totalResistance);
	}

	public double getSlidePercent()
	{
		return slidePercent;
	}

	public void setSlidePercent(double slidePercent)
	{
		if(slidePercent>=0&&slidePercent<=1)
		{
			this.slidePercent = slidePercent;
		}
	}

	public double getLeftResistance()
	{
		return slidePercent*totalResistance;
	}

	public double getRightResistance()
	{
		return (1-slidePercent)*totalResistance;
	}
}
